/**
 * 
 */
package gestionBulletins.model.persistance.sqliteImpl;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

import gestionBulletins.model.persistance.DaoAdherent;
import gestionBulletins.model.persistance.DaoEnfant;
import gestionBulletins.model.persistance.DaoFactory;
import gestionBulletins.model.persistance.DaoSection;

/**
 * Implémentation de la fabrique de DAO pour le type de persistance SQLite
 * @author Paraita Wohler
 *
 */
public class DaoFactorySqliteImpl implements DaoFactory {
	
	Connection conn;
	
	public DaoFactorySqliteImpl() {
		try {
			Class.forName("org.sqlite.JDBC");
			conn = DriverManager.getConnection("jdbc:sqlite:bdd.sqlite");
		}
		catch (ClassNotFoundException e) {
			e.printStackTrace();
		}
		catch (SQLException e) {
			e.printStackTrace();
		}
	}

	/* (non-Javadoc)
	 * @see gestionBulletins.model.persistance.DaoFactory#getDaoAdherent()
	 */
	@Override
	public DaoAdherent getDaoAdherent() {
		return new DaoAdherentSqliteImpl(conn);
	}

	/* (non-Javadoc)
	 * @see gestionBulletins.model.persistance.DaoFactory#getDaoEnfant()
	 */
	@Override
	public DaoEnfant getDaoEnfant() {
		return new DaoEnfantSqliteImpl(conn);
	}

	/* (non-Javadoc)
	 * @see gestionBulletins.model.persistance.DaoFactory#getDaoSection()
	 */
	@Override
	public DaoSection getDaoSection() {
		return new DaoSectionSqliteImpl(conn);
	}

}
